<?php

require_once("smarty/Smarty.class.php");

function render($template, $context=array()) {
	date_default_timezone_set("America/New_York");
	$s = new Smarty();
	foreach($context as $key => $value) {
		$s->assign($key, $value);
	}
	
	$s->assign("categories", get_categories());
	$s->assign("ratings", get_ratings());
	$s->assign("is_logged_in", is_logged_in());
	
	$s->display("templates/$template.tpl");
}


function redirect($url) {
	header("Location: $url");
}
function get_categories (){
	return array (
		1 => "Facilities", 
		2 => "Admin Tools",
		3 => "Member Tools",
		4 => "Aesthetics",
		5 => "Other"
	);
}
function get_ratings (){
	return array (
		1 => "Cumbersome",
		2 => "A Real Burden", 
		3 => "Grievous Harm",
		4 => "Kill it with Fire"
	);
}

function is_logged_in() {
	@session_start();
	return isset($_SESSION['logged_in_user']) && $_SESSION['logged_in_user'] > 0;
}
